package com.inno.life.infra.basic.service.impl;

import com.github.pagehelper.PageHelper;
import com.inno.life.infra.basic.entity.PlannerMomentSensitiveWords;
import com.inno.life.infra.basic.mapper.PlannerMomentSensitiveWordsDao;
import com.inno.life.infra.basic.service.PlannerMomentSensitiveWordsService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (PlannerMomentSensitiveWords)表服务实现类
 *
 * @author makejava
 * @since 2024-11-25 21:03:30
 */
@Slf4j
@Service
public class PlannerMomentSensitiveWordsServiceImpl implements PlannerMomentSensitiveWordsService {

    @Resource
    private  PlannerMomentSensitiveWordsDao plannerMomentSensitiveWordsDao;


//    public PlannerMomentSensitiveWordsServiceImpl(PlannerMomentSensitiveWordsDao plannerMomentSensitiveWordsDao) {
//        this.plannerMomentSensitiveWordsDao = plannerMomentSensitiveWordsDao;
//        log.info("PlannerMomentSensitiveWordsServiceImpl init :{}",this.plannerMomentSensitiveWordsDao);
//    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PlannerMomentSensitiveWords queryById(Long id) {
        return this.plannerMomentSensitiveWordsDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param plannerMomentSensitiveWords 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerMomentSensitiveWords insert(PlannerMomentSensitiveWords plannerMomentSensitiveWords) {
        this.plannerMomentSensitiveWordsDao.insert(plannerMomentSensitiveWords);
        return plannerMomentSensitiveWords;
    }

    /**
     * 修改数据
     *
     * @param plannerMomentSensitiveWords 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerMomentSensitiveWords update(PlannerMomentSensitiveWords plannerMomentSensitiveWords) {
        this.plannerMomentSensitiveWordsDao.update(plannerMomentSensitiveWords);
        return this.queryById(plannerMomentSensitiveWords.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.plannerMomentSensitiveWordsDao.deleteById(id) > 0;
    }

    @Override
    public List<PlannerMomentSensitiveWords> queryAll() {
        return this.plannerMomentSensitiveWordsDao.queryAll();
    }

    @Override
    public long count(PlannerMomentSensitiveWords plannerMomentSensitiveWords) {
        return this.plannerMomentSensitiveWordsDao.count(plannerMomentSensitiveWords);
    }

    @Override
    public List<PlannerMomentSensitiveWords> queryAllByLimit(int page, int pageSize) {
        PageHelper.startPage(page, pageSize);
        return this.plannerMomentSensitiveWordsDao.queryAll();
    }
}
